<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.SQLException" %><%--
  Created by IntelliJ IDEA.
  User: 28064
  Date: 2022/3/21
  Time: 16:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:useBean id="book" class="com.JavaBean.BookDAO" scope="session"/>
<%--<jsp:getProperty name="book" property="*"/>--%>
<html>
<head>
    <title>display books</title>
    <style>
        table {
            font-family: "FiraCode Nerd Font", 'serif';
            width: auto;
            height: fit-content;
            text-align: center;
            align-content: center;
        }
        td {text-align: center;}
    </style>
</head>
<body >
<table border="1" >
    <tr>
        <th scope="col">bookId</th>
        <th scope="col">title</th>
        <th scope="col">author</th>
        <th scope="col">publisher</th>
        <th scope="col">price</th>
    </tr>
    <%! int i = 1;%>
    <%
        try {
            ResultSet rs = book.result();
            while (rs.next()) { %>
    <tr>
        <td><%=rs.getString(1)  %>
        </td>
        <td><%=rs.getString(2)  %>
        </td>
        <td><%=rs.getString(3)  %>
        </td>
        <td><%=rs.getString(4)  %>
        </td>
        <td><%=rs.getString(5)  %>
        </td>
    </tr>
    <% i++;
    }
        rs.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
    %>
</table>
</body>
</html>
